//品牌管理-品牌列表
App.util.ns('Admin.Goods.Brand');
App.pages.add((function(){
    var NS = Admin.Goods.Brand;
    var page = new App.Page({
        name: 'goods/brand/index'
    });
    //页面初始化
    page.initStack.add('dataTable', function(){
        //面包屑导航
        this.setBreadcrumb([{
            icon: '<i class="fa fa-crosshairs"></i>',
            content: '品牌管理'
        }, {
            content: '品牌列表'
        }]);
        this.dataTable = new App.DataTable({
            baseUrl: '/admin/goods/brand',
            dataUrl: 'lists',
            table: {
                id: 'id',
                main: 0,
                //showId: false,
                columns: App.util.copy(NS.Conf.columns)
            },
            filter: [
                {type: 'keywords'},
                {type: 'timeRange'},
                {type: 'select', name: 'status', title: '状态', width: '80px', items: [
                    [0, '停用'],
                    [1, '正常']
                ]}
            ],
            menu: [
                {parent: 'add', permission: 'op:admin.enterprise.enterprise.create'},
                {parent: 'view', permission: 'op:admin.enterprise.enterprise.detail'},
                {parent: 'edit', permission: 'op:admin.enterprise.enterprise.update'},
                {type: 'inline', permission: 'op:admin.enterprise.enterprise.open',
                    name: '开启', operation: {type: 'change', url: 'open'},
                    conditions: [['status', '0']]
                },
                {type: 'inline', permission: 'op:admin.enterprise.enterprise.close',
                    name: '关闭', operation: {type: 'change', url: 'close'},
                    conditions: [['status', '1']]
                },
                {parent: 'drop', permission: 'op:admin.enterprise.enterprise.delete'},
                {parent: 'multiDrop', permission: 'op:admin.enterprise.enterprise.multiDelete'},
                {parent: 'oplog', permission: 'op:admin.enterprise.enterprise.getOpLogs'}
            ],
            detail: {
                form: {
                    items: App.util.copy(NS.Conf.form),
                }
            }
        }, page);
        this.dataTable.fix(this.contentContainer);
        this.dataTable.loadData();
    });
    //页面刷新
    page.refreshStack.add('dataTable', function(){
        this.dataTable.loadData(true);
    });
    //页面销毁
    page.destroyStack.add('dataTable', function(){
        this.dataTable.destroy();
    });
    return page;
})());